<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">{{Lang.lang('競猜記錄')}}</view>
			<view class="back"></view>
			<!-- <view class="rule">规则</view> -->
		</view>



		<view class="nav">
			<block v-for="(item, index) in nav" :key="index">
				<view class="menu" :class="select == index ? 'menucolor' : ''" :data-index="index" @tap="setNavMenu">
					{{Lang.lang(item.menu)}}
				</view>
			</block>
		</view>

		<view class="clear_box"></view>
		<view class="clear_box02"></view>




		<block v-if="select == 0">
			<view class="page_content">
				<block v-for="(item,index) in log_list" :key="index">
					<view class="publish_list">
						<view class="rank_box">
							<view class="rank">{{item.add_time}}</view>
							<view class="type">
								<span v-if="item.is_jackpot == 0">{{Lang.lang('待開獎')}}</span>
								<span v-if="item.is_jackpot == 1">{{Lang.lang('已中獎')}}</span>
								<span v-if="item.is_jackpot == 2">{{Lang.lang('未中獎')}}</span>

							</view>
						</view>
						<view class="title_box">
							<view class="title">YYDZ {{Lang.lang('今日是漲還是跌')}}？</view>
							<view class="type" v-if="item.betting_type == 1">{{Lang.lang('漲')}}</view>
							<view class="type type02" v-if="item.betting_type == 2">{{Lang.lang('跌')}}</view>
						</view>
						<view class="other_box">
							<view class="other">{{Lang.lang('您已投入')}}：<span>{{item.num}}</span>YYDZ</view>
							<view class="other" v-if="item.is_jackpot == 1">
								{{Lang.lang('獲得')}}：<span>{{item.jackpot_money}}</span>YYDZ
							</view>
						</view>

					</view>
				</block>
			</view>
		</block>

		<block v-if="select == 1">
			<view class="page_content">
				<block v-for="(item,index) in log_list" :key="index">
					<view class="publish_list">
						<view class="rank_box">
							<view class="rank">{{item.add_time}}</view>
							<view class="type">
								<span v-if="item.is_jackpot == 0">{{Lang.lang('待開獎')}}</span>
								<span v-if="item.is_jackpot == 1">{{Lang.lang('已中獎')}}</span>
								<span v-if="item.is_jackpot == 2">{{Lang.lang('未中獎')}}</span>

							</view>
						</view>
						<view class="title_box">
							<view class="title">YYDZ {{Lang.lang('今日是漲還是跌')}}？</view>
							<view class="type" v-if="item.betting_type == 1">{{Lang.lang('漲')}}</view>
							<view class="type type02" v-if="item.betting_type == 2">{{Lang.lang('跌')}}</view>
						</view>
						<view class="other_box">
							<view class="other">{{Lang.lang('您已投入')}}：<span>{{item.num}}</span>YYDZ</view>
							<view class="other" v-if="item.is_jackpot == 1">
								{{Lang.lang('獲得')}}：<span>{{item.jackpot_money}}</span>YYDZ
							</view>
						</view>

					</view>
				</block>
			</view>
		</block>

		<block v-if="select == 2">
			<block v-for="(item, index) in log_list" :key="index">
				<view class="gameplay_content">
					<view class="gameplay_auto">
						<view class="gameplay_text">
							<view class="title">{{item.venue_s}} - {{item.betting_type_s}}
							</view>
							<view class="text">{{item.add_time}}</view>
						</view>

						<view class="gameplay_img" v-if="item.is_zj == 1">
							<image v-if="lang=='tc'" src="../../static/game/game3_s_1_tc.png" mode="widthFix"></image>
							<image v-if="lang=='en'" src="../../static/game/game3_s_1_en.png" mode="widthFix"></image>
						</view>
						<view class="gameplay_img" v-if="item.is_zj == 2">
							<image v-if="lang=='tc'" src="../../static/game/game3_s_2_tc.png" mode="widthFix"></image>
							<image v-if="lang=='en'" src="../../static/game/game3_s_2_en.png" mode="widthFix"></image>
						</view>
						<view class="gameplay_img" v-if="item.is_zj == 3">
							<image v-if="lang=='tc'" src="../../static/game/game3_s_3_tc.png" mode="widthFix"></image>
							<image v-if="lang=='en'" src="../../static/game/game3_s_3_en.png" mode="widthFix"></image>
						</view>

					</view>
					<view class="rule">{{Lang.lang('您已投入')}}：<span>{{item.participation_amount}}</span>YYDZ</view>
					<!-- <view class="text">註：如果中獎，需支付<span>10积分</span>作為手續費</view> -->
				</view>
			</block>

		</block>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				lang: 'en',
				link: '',
				pupu: false,
				scrrol: false,
				info: '',
				nav: [{
						menu: '競猜1',
					},
					{
						menu: '競猜2',
					},
					{
						menu: '競猜3',
					}
				],
				select: 0,
				page: 0,
				log_list: [],
			}
		},
		onLoad() {

		},
		onShow() {
			let that = this;
			that.lang = uni.getStorageSync('_language');
			that.loadData();
		},
		methods: {
			setNavMenu(e) {
				let that = this;
				let index = e.currentTarget.dataset.index;
				that.select = index;
				that.loadData();
			},
			loadData() {
				let that = this;
				that.page = 0;
				that.log_list = [];
				that.loadPageData();
			},
			loadPageData() {
				let that = this;
				that.page++;
				that.Net._post('api/game/gameLog', {
					p_type: parseInt(that.select) + 1,
					page: that.page
				}, res => {
					if (res.code == 200) {
						that.log_list = that.log_list.concat(res.data.log_list); //将数据拼接在一起
					}
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
			let that = this;
			that.loadPageData()
		},
	}
</script>

<style>
	.clear_box02 {
		height: 13vw;
	}

	.header {
		background-color: transparent !important;
	}

	.header .text {
		text-align: center;
	}

	.page_content {
		width: 92%;
		margin: 0 auto;
	}

	.scrrolHeader {
		width: 100%;
		background-color: #090909 !important;

	}

	.slide-main {
		width: 100%;

	}

	.list {
		width: 100%;
		margin-top: 4vw;
		overflow: hidden;
		border-radius: 4vw;
	}

	.publish_list {
		width: 100%;
		padding: 4vw;
		border-radius: 4vw;
		background-color: #1A1A1A;
		margin-top: 4%;
	}

	.publish_list .rank_box {
		width: 100%;
		display: flex;
		align-items: center;
		border-bottom: 1px solid #4A4A4A;
		padding-bottom: 4vw;

	}

	.publish_list .rank_box .rank {
		flex: 1;
		font-size: 3.5vw;
		color: #BDBDBD;
	}

	.publish_list .rank_box .type {
		font-size: 3.5vw;
		color: #fff;
	}



	.publish_list .title_box {
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 3vw;
	}

	.publish_list .title_box .title {
		font-size: 4.5vw;
		color: #fff;
		font-weight: bold;
		flex: 1;
	}

	.publish_list .title_box .type {
		width: 16vw;
		height: 8vw;
		background-color: #0055FE;
		border-radius: 1vw;
		font-size: 3.8vw;
		color: #fff;
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 3vw;
	}

	.type02 {
		background-color: #238D76 !important;
	}

	.type03 {
		background-color: #CFA46B !important;
		color: #333 !important;
	}

	.publish_list .other_box {
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 3vw;
		background-color: #0B0B11;
		height: 13vw;
		border-radius: 2vw;
		padding: 0 3vw;
	}

	.publish_list .other_box .other {
		flex: 1;
		font-size: 3.5vw;
		color: #fff;
		display: flex;
		align-items: center;
	}

	.publish_list .other_box .other span {
		color: #CEA36A;
	}

	.publish_list .other_box .other:nth-child(2) {
		justify-content: flex-end;
	}


	/*  */

	.nav {
		width: 100%;
		padding: 0 10%;
		height: 13vw;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: fixed;
		left: 0;
		top: calc(17vw + var(--status-bar-height));
		z-index: 999999;
		background-color: #090909;
	}

	.nav .menu {
		height: 100%;
		line-height: 13vw;
		font-size: 4vw;
		color: #fff;
		font-weight: bold;
	}

	.menucolor {
		border-bottom: 5px solid #0055FE !important;
	}

	.gameplay_content {
		width: 92%;
		margin: 0 auto;
		background-color: #1A1A1A;
		margin-top: 4%;
		padding: 5vw 4vw;
		border-radius: 3vw;
	}

	.gameplay_auto {
		width: 100%;
		display: flex;
	}

	.gameplay_auto .gameplay_text {
		flex: 1;
	}

	.gameplay_auto .gameplay_img {
		width: 18vw;
		margin-left: 3vw;
	}

	.gameplay_auto .gameplay_img image {
		width: 100%;
	}


	.gameplay_content .title {
		font-size: 5vw;
		color: #fff;
		font-weight: bold;
	}

	.gameplay_content .text {
		font-size: 3.5vw;
		color: #999;
		margin-top: 3vw;
	}

	.gameplay_content .text span {
		color: #E92857;
	}

	.gameplay_content .rule {
		font-size: 3.5vw;
		color: #999;
		background-color: #0B0B11;
		padding: 3vw 4vw;
		border-radius: 2vw;
	}

	.gameplay_content .rule span {
		color: #E92857;
	}

	.range_box {
		width: 100%;
		display: flex;
		align-items: center;
		margin-top: 4vw;
		position: relative;
	}

	.range_box .menu {
		flex: 1;
		height: 15vw;

		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 5vw;
		color: #fff;
		font-weight: bold;
		background-color: #333333;
	}

	.range_box .menu:nth-child(1) {
		border-radius: 15vw 0vw 0vw 15vw;
	}

	.range_box .menu:nth-child(2) {
		border-radius: 0 15vw 15vw 0;

	}

	.range_box .line {
		width: 3vw;
		background-color: #1A1A1A;
		height: 100%;
		position: absolute;
		left: calc(50% - 1.5vw);
		top: 0;
		transform: skewX(-10deg);
		/* 沿着X轴倾斜30度 */
		transform-origin: right;
		/* 设置变形的原点在右边 */
	}

	.gameplay_content .menu_box {
		width: 100%;
		margin-top: 4vw;
		display: flex;
		align-items: center;
	}

	.gameplay_content .menu_box .menu {
		width: 22vw;
		height: 10vw;
		border-radius: 10vw;
		color: #fff;
		background-color: #FF295E;
		font-size: 3.6vw;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 4%;
	}

	.gameplay_content .menu_box .reset {
		width: 15vw;
		height: 10vw;
		border-radius: 2vw;
		color: #fff;
		font-size: 3.5vw;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 4%;
		border: 1px solid #333333;
	}

	.gameplay_content .menu_box .num_box {
		flex: 1;
		height: 10vw;
		border: 1px solid #333333;
		border-radius: 2vw;
		display: flex;
		align-items: center;
	}

	.gameplay_content .menu_box .num_box .down {
		font-size: 4vw;
		color: #fff;
		width: 10vw;
		height: 10vw;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.gameplay_content .menu_box .num_box .up {
		font-size: 4vw;
		color: #fff;
		width: 10vw;
		height: 10vw;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.gameplay_content .menu_box .num_box .num {
		flex: 1;
		height: 100%;
		border-left: 1px solid #333;
		border-right: 1px solid #333;
		display: flex;
		align-items: center;
		justify-content: center;
		padding-right: 1vw;
	}

	.gameplay_content .menu_box .num_box .num input {
		flex: 1;
		margin-right: 2vw;
		text-align: right;
		color: #fff;
		font-size: 3.5vw;
	}

	.gameplay_content .menu_box .num_box .num .t {
		font-size: 3vw;
		color: #999999;
	}

	/*  */
</style>